<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>订单拣货</title>
    <link rel="shortcut icon" href="favicon.ico">
    <script src="../../res/js/comm.js?v=1.26.0"></script>
    <!--写公共的css文件-->
    <link href="../../res/plugins/bootstrap/css/bootstrap.min14ed.css?v=3.3.6" rel="stylesheet">
    <link href="../../res/plugins/bootstrap/css/font-awesome.min93e3.css?v=4.4.0" rel="stylesheet">
    <link href="../../res/plugins/bootstrap/css/plugins/bootstrap-table/bootstrap-table.min.css" rel="stylesheet">
    <link href="../../res/plugins/bootstrap/css/animate.min.css" rel="stylesheet">
    <link href="../../res/plugins/bootstrap/css/style.min862f.css?v=4.1.0" rel="stylesheet">
    <link rel="stylesheet" href="../../res/plugins/layerui/layui/css/layui.css" media="all">
    <!--共用的js文件-->
    <!--openx 控件,远程地址：https://openx.yifengx.com/js/openx.js-->
    <script src="../../res/js/openx.js"></script>
    <!--表格控件-->
    <script src="../../res/plugins/bootstrap/js/plugins/bootstrap-table/bootstrap-table.min.js"></script>
    <script src="../../res/plugins/bootstrap/js/plugins/bootstrap-table/bootstrap-table-mobile.min.js"></script>
    <script src="../../res/plugins/bootstrap/js/plugins/bootstrap-table/locale/bootstrap-table-zh-CN.min.js"></script>
    <script src="../../res/plugins/bootstrap/js/plugins/bootstrap-table/table-export/bootstrap-table-export.js"></script>
    <script src="../../res/plugins/bootstrap/js/plugins/bootstrap-table/table-export/tableExport.js"></script>

    <!--弹出层控件-->
    <script src="../../res/plugins/layerui/layer/layer.js"></script>
    <!--模版控件-->
    <script src="../../res/plugins/layerui/layer/laytpl.js"></script>

    <!--美化滚动条 参考：http://manos.malihu.gr/jquery-custom-content-scroller -->
    <script src="../../res/js/utils.js"></script>
    <script src="../../res/plugins/layerui/layui/layui.js" charset="utf-8"></script>
</head>

<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="panel panel-info">
        <div class="panel-heading"><i class="fa fa-info-circle"></i> 订单拣货</div>
        <div class="panel-body">
            <div class="ibox-query">
                <form id="queryForm" method="post" class="form-horizontal">
                    <input id='orderStatus' name="orderStatus" type="hidden" value=''/>
                    <input id='deliveryStatus' name="deliveryStatus" type="hidden" value=''/>
                    <input id='postingStatus' name="postingStatus" type="hidden" value=''/>
                    <input id='refundStatus' name="refundStatus" type="hidden" value=''/>
                    <input id='deliveryType' name="deliveryType" type="hidden" value=''/>
                    <div class="form-group">

                        <label class="col-sm-1 control-label">顶级渠道</label>
                        <div class="col-sm-2" name="channelPluginsDiv"></div>

                        <label class="col-sm-1 control-label">订单编码</label>
                        <div class="col-sm-2"><input name="orderCode" class="form-control" type="text"></div>

                        <label class="col-sm-1 control-label">父订单编码</label>
                        <div class="col-sm-2">
                            <input name="parentOrderCode" class="form-control" type="text">
                        </div>

                        <label class="col-sm-1 control-label">第三方订单号</label>
                        <div class="col-sm-2"><input name="outTradeCode" class="form-control" type="text"></div>

                    </div>

                    <div class="form-group">
                        <!-- <label class="col-sm-1 control-label">会员电话</label>
                        <div class="col-sm-2">
                            <input name="customerPhone" class="form-control" type="text">
                        </div> -->

                        <label class="col-sm-1 control-label">配送方式</label>
                        <div class="col-sm-2" name="providerSelectsPluginsDiv"></div>

                        <label class="col-sm-1 control-label">收货人姓名</label>
                        <div class="col-sm-2"><input name="receiverName" class="form-control" type="text"></div>

                        <label class="col-sm-1 control-label">收货人电话</label>
                        <div class="col-sm-2"><input name="receiverPhone" class="form-control" type="text"></div>

                        <label class="col-sm-1 control-label">是否要发票</label>
                        <div class="col-sm-2">
                            <select name="needInvoice" class="form-control" onchange="javascript:$.openx.query()">
                                <option value="">--请选择--</option>
                                <option value="Y">需要发票</option>
                                <option value="N">不需要发票</option>
                            </select>
                        </div>

                    </div>

                    <div class="form-group">

                        <label class="col-sm-1 control-label">下单开始时间</label>
                        <div class="col-sm-2"><input class="layui-input" id='createStartTime' name="createStartTime"  placeholder="下单开始时间" type="text" readonly onclick="layui.laydate({elem: this,isclear:false, istime: true, format: 'YYYY-MM-DD hh:mm:ss'})"> </div>

                        <label class="col-sm-1 control-label">下单结束时间</label>
                        <div class="col-sm-2"><input class="layui-input" id='createEndTime' name="createEndTime"   placeholder="下单结束时间" type="text" readonly   onclick="layui.laydate({elem: this,isclear:false, istime: true, format: 'YYYY-MM-DD hh:mm:ss'})"> </div>

                        <label class="col-sm-1 control-label">收款方</label>
                        <div class="col-sm-2">
                            <select name="payee" class="form-control" onchange="javascript:$.openx.query()">
                                <option value="">--请选择--</option>
                                <option value="PAYEE_YIFENG">益丰收款</option>
                                <option value="PAYEE_THIRD">三方渠道</option>
                            </select>
                        </div>

                        <div>
                            <button style="margin-left: 50px;" class="btn btn-info" onclick='$.openx.query()' type="button"><i class="glyphicon glyphicon-search"></i> 查询</button>

                            <button style="margin-left: 10px;" class="btn btn-info" onclick="resetForm()" type="button"><i class="glyphicon glyphicon-share-alt"></i> 重置  </button>
                        </div>
                    </div>
                    <div class="hr-line-dashed"></div>
                </form>
            </div>

            <div class="row row-lg">
                <div class="col-sm-12">
                    <div class="bars pull-left">
                        <p>
                            <!--<button type="button" class="btn btn-sm btn-warning" style="margin-right: 20px" onclick="batchPrintlnTicket()"> <i></i> 批量小票打印  </button>-->
                            <button type="button" name="orderStatus" value="ALL" class="btn btn-sm btn-info"><i  class="glyphicon glyphicon-ok-sign"></i> <small>全部</small></button>
                            <button type="button" name="orderStatus" value="DELIVERY_WAITING" class="btn btn-sm btn-primary"><i></i> 待发货</button>
                            <button type="button" name="orderStatus" value="RECEIVE_WAITING" class="btn btn-sm btn-danger"><i></i> 已发货 </button>
                            <button type="button" name="orderStatus" value="ORDER_FINISH" class="btn btn-sm btn-success"><i></i> 已完成</button>
                            <button type="button" name="orderStatus" value="ORDER_CLOSE" class="btn btn-sm btn-default"> <i></i> 订单关闭  </button>

                            <button type="button" style="margin-left:100px;" name="orderStatus" value="DELIVERY_EXCEPTION" class="btn btn-sm btn-danger"><i></i> 配送异常</button>
                            <button type="button" name="orderStatus" value="WAITING_POSTING" class="btn btn-sm btn-warning"><i></i> 待下账 </button>
                            <button type="button" name="orderStatus" value="2" class="btn btn-sm btn-info"><i></i> 退货中</button>
                            <button type="button" name="orderStatus" value="1" class="btn btn-sm btn-default"> <i></i> 已退货  </button>
                            <button type="button" name="orderStatus" value="SELF_PICK" class="btn btn-sm btn-success"> <i></i> 待自提  </button>

                            <button type="button" style="margin-left:100px;"  id='batchprint' onclick="batchPrintlnTickeBefore()" class="btn btn-sm btn-info"> <i></i> 批量打印  </button>
                            <button type="button" id='batchPosting' onclick="batchPosting()" class="btn btn-sm btn-info"> <i></i> 批量下账  </button>
                        </p>
                    </div>


                    <table id="table" data-show-export="true">
                        <thead>
                        <tr>
                            <th data-field="stats" data-checkbox="true"></th>
                            <th data-align="center" data-field="id"  data-formatter="$.openx.generatorId" > 序号</th>
                            <th data-align="center" data-formatter="operationFormat" data-width="250px">操作</th>
                            <th data-align="center" data-field="parentOrderCode" data-visible="false">父订单号</th>
                            <th data-align="center" data-field="orderCode" data-formatter="showOrderDetailFormat"  >订单号</th>
                            <th data-align="center" data-field="ticketNum" >小票号</th>
                            <th data-align="center" data-field="outTradeCode"  data-visible="false">第三方订单号</th>
                            <th data-align="center" data-field="state">订单状态</th>
                            <th data-align="center" data-field="billType" data-formatter="billTypeFormat">订单类型</th>
                            <th data-align="center" data-field="topChannelCode" data-formatter="topChannelFormat">顶级渠道</th>
                            <th data-align="center" data-field="warehouseCode" data-formatter="warehouseCodeFormatter" data-visible="false">发货仓库</th>
                            <th data-align="center" data-field="logisticsId">配送方式</th>
                            <th data-align="center" data-field="payee" data-visible="false">收款方</th>
                            <th data-align="center" data-field="customerNeedPayAmount">实付金额</th>
                            <th data-align="center" data-field="createTime" data-formatter="createTimeFormat" >下单时间</th>
                            <th data-align="center" data-field="needInvoice" data-formatter="needInvoiceFormat" >要发票</th>
                            <th data-align="center" onclick="showAll()" data-field="remark"  data-formatter='remarkFormat'>备注</th>
                        </tr>
                        </thead>
                    </table>
                </div>
            </div>
        </div>
    </div>
</div>

<!-- 订单详情-->
<!-- 退货入库按钮去掉
 <p>
            {{# if(d.isRefund === 'Y' && d.refunded === '2'){  }} <button type="button" class="btn btn-warning btn-xs" onclick="refundOrderStockConfirm('{{d.orderCode}}')">退货入库</button>  {{# } }}
        </p>
 -->
<script type="text/html" id="orderDetailTpl">
    <div id="orderPickDetailDiv" style="padding: 10px">
        <p>
            {{# if(d.ordonnanceId || d.prescriptFileIsExist === 'Y' ){  }} <button type="button" class="btn btn-danger btn-xs" onclick ="javascript:showPickRecipe('{{d.topChannelCode}}')">查看处方</button> {{# } }}
            {{# if(d.posCode === undefined || d.posCode === '' || d.posCode === '000000'){ }}
            <button type="button" class="btn btn-info btn-xs" onclick="fillingCustomerInfo()">完善信息</button>
            {{# } }}
            {{# if(d.state != 'PAYMENT_WAITING' && d.state != 'AUDIT_WAITING' && d.state != 'DELIVERY_WAITING'){ }}
            <button type="button" class="btn btn-info btn-xs" onclick="queryLogistics()">物流查询</button>
            {{# } }}
        </p>
        <table class="layui-table">
            <tbody>
            <tr>
                <td rowspan="5"  class="layui-table-td-bg">基本信息:</td>
                <td class="layui-table-td-bg">渠道</td>
                <td class="text-center" width="150px">  {{d.channelName ? d.channelName :"" }}    </td>
                <td class="layui-table-td-bg">订单号</td>
                <td class="text-center">{{d.orderCode ? d.orderCode :"" }}</td>
                <td class="layui-table-td-bg">父订单编码</td>
                <td class="text-center">{{d.parentOrderCode ? d.parentOrderCode :"" }}</td>
            </tr>
            <tr>
                <td class="layui-table-td-bg">商品总金额</td>
                <td class="text-center">{{d.goodsTotalAmount}}</td>
                <td class="layui-table-td-bg">益丰实收金额</td>
                <td class="text-center">{{d.needReceiveAmount ? d.needReceiveAmount : 0 }}</td>
                <td class="layui-table-td-bg">优惠总金额</td>
                <td class="text-center">{{d.preferentialTotalAmount ? d.preferentialTotalAmount : 0 }}</td>
            </tr>
            <tr>
                <td class="layui-table-td-bg">补贴总金额</td>
                <td class="text-center">{{d.subsidyTotalAmount ? d.subsidyTotalAmount : 0 }}</td>
                <td class="layui-table-td-bg">用户实付金额</td>
                <td class="text-center">{{d.customerNeedPayAmount ? d.customerNeedPayAmount :0 }}</td>
                <td class="layui-table-td-bg">第三方订单号</td>
                <td class="text-center">{{d.outTradeCode ? d.outTradeCode :"" }}</td>
            </tr>
            <tr>
                <td class="layui-table-td-bg">配送类型</td>
                <td class="text-center">{{d.deliveryType ? d.deliveryType:""}}</td>
                <td class="layui-table-td-bg">配送费用</td>
                <td class="text-center">{{d.deliveryAmount ? d.deliveryAmount :0}}</td>
                <td class="layui-table-td-bg">POS单号</td>
                <td class="text-center">{{(d.posCode && d.posCode!='000000') ? d.posCode :"" }}</td>
            </tr>
            <tr>
                <td class="layui-table-td-bg">收款方</td>
                <td class="text-center">{{d.payeeDesc ? d.payeeDesc :"" }}</td>
                <td class="layui-table-td-bg">下单时间</td>
                <td class="text-left">{{d.createTime ? d.createTime:""}}</td>
                <td class="layui-table-td-bg">退货退款</td>
                <td class="text-center"  >{{d.refundAmount ? '-'+d.refundAmount:0}}</td>
            </tr>
            <tr>
                <td rowspan="1"  class="layui-table-td-bg">收件人信息</td>
                <td class="layui-table-td-bg">收件人姓名</td>
                <td class="text-center">{{d.receiverName?d.receiverName:""}}</td>
                <td class="layui-table-td-bg">收件人电话</td>
                <td class="text-center">{{d.receiverPhone?d.receiverPhone:""}}</td>
                <td class="layui-table-td-bg">收件人地址</td>
                <td class="text-center">{{d.address?d.address.replace(/-/g, ""):""}}</td>
            </tr>
            <tr>
                <td rowspan="1"  class="layui-table-td-bg">其它费用</td>
                <td class="layui-table-td-bg">包装费</td>
                <td class="text-center">{{d.packingAmount?d.packingAmount: 0}}</td>
                <td class="layui-table-td-bg">{{d.employee? "营业员" :""}}</td>
                <td class="text-center">{{d.employee?d.employee:""}}</td>
                <td class="layui-table-td-bg">&nbsp;</td>
                <td class="text-center">&nbsp;</td>
            </tr>
            <tr>
                <td rowspan="1" colspan="7"  class="layui-table-td-bg">商品信息</td>
            </tr>
            <tr>
                <td colspan="7" style="padding: 4px;">
                    <table class="layui-table" style="text-align: center;margin: 0px">
                        <thead>
                        <tr>
                            <th style="text-align: center">商品图片</th>
                            <th style="text-align: center">商品编码</th>
                            <th style="text-align: center">商品名称</th>
                            <th style="text-align: center">UPC(69)码</th>
                            <th style="text-align: center">规格</th>
                            <th style="text-align: center">执行价</th>
                            <th style="text-align: center">数量</th>
                            <th style="text-align: center">执行价合计(元)</th>
                        </tr>
                        </thead>
                        <tbody>
                        {{#  layui.each(d.listGoods, function(index, item){ }}
                        <tr>
                            <td><img src="{{item.imgeUrl}}" width="40px" height="40px"></td>
                            <td> {{ item.goodsCode }}</td>
                            <td>{{item.goodsName}}</td>
                            <td>{{item.mainBarcode?item.mainBarcode:"无"}}</td>
                            <td>{{item.standard?item.standard:"无"}}</td>
                            <td>{{item.exercisePrice}}</td>
                            <td>{{item.quantity}}</td>
                            <td>{{item.exerciseAmount}}</td>
                        </tr>
                        {{# }); }}
                        </tbody>
                    </table>
                </td>
            </tr>
            <tr>
                <td rowspan="1"  class="layui-table-td-bg">发票信息</td>
                <td class="layui-table-td-bg">纳税人识别码</td>
                <td class="text-center">{{d.invoiceCode ? d.invoiceCode:"-"}}</td>
                <td class="layui-table-td-bg">发票抬头</td>
                <td class="text-center">{{d.invoiceTitle ? d.invoiceTitle :"-"}}</td>
                <td class="layui-table-td-bg">发票内容</td>
                <td class="text-center">{{d.invoiceContent ? d.invoiceContent :"-" }}</td>
            </tr>
            <tr>
                <td rowspan="1"  class="layui-table-td-bg"></td>
                <td class="layui-table-td-bg">接收人手机</td>
                <td class="text-center">{{d.invoiceMobile ? d.invoiceMobile:""}}</td>
                <td class="layui-table-td-bg">接收人邮箱</td>
                <td class="text-center">{{d.invoiceEmail ? d.invoiceEmail :""}}</td>
                <td class="layui-table-td-bg"></td>
                <td class="text-center"></td>
            </tr>

            <tr>
                <td rowspan="1" class="layui-table-td-bg" >附加信息:</td>
                <td colspan="7">
                    {{# layui.each(d.additionalInfos, function(index, item){ }}
                    {{index+1}} 、 {{item.infoName ? item.infoName :""}} ： {{item.infoValue ? item.infoValue :""}}   &nbsp;&nbsp;&nbsp;&nbsp;
                    {{# }); }}
                </td>
            </tr>
            <tr>
                <td rowspan="1" class="layui-table-td-bg" >备注:</td>
                <td colspan="7">{{d.remark ? d.remark:""}}</td>
            </tr>

            <tr>
                <td rowspan="1" colspan="7"  class="layui-table-td-bg">退货信息</td>
            </tr>
            <tr>
                <td colspan="7" style="padding: 4px;">
                    <table class="layui-table" style="text-align: center;margin: 0px">
                        {{#  layui.each(d.orderRefundList, function(index, item){ }}
                        <thead>
                        <tr>
                            <th style="text-align: center">退货单编码</th>
                            <th style="text-align: center">pos编码</th>
                            <th style="text-align: center">订单编码</th>
                            <th style="text-align: center">退款总金额</th>
                            <th style="text-align: center">是否需要退运费</th>
                            <th style="text-align: center">退货原因</th>
                            <th style="text-align: center">状态</th>
                            <th style="text-align: center">退货运单号</th>
                        </tr>
                        </thead>
                        <tbody>
                        <tr>
                            <td>{{item.refundCode}}</td>
                            <td> {{(item.posCode && item.posCode!='000000')?item.posCode:""}}</td>
                            <td>{{item.orderCode}}</td>
                            <td>{{item.totalAmount?item.totalAmount:"0.00"}}</td>
                            <td>{{item.isRefundFreight ? (item.isRefundFreight ==='Y' ? "是" : "否") :"-"}}</td>
                            <td>{{item.reason }}</td>
                            <td>{{item.status ==='1'?"已退货":item.status==='2'?"退货中":item.status==='0'?"待审核":item.status==='3'?"已拒绝":item.status==='4'?"已关闭":item.status==='9'?"初始化":"-"}}</td>
                            <td>{{item.waybillCode?item.waybillCode:""}}</td>
                        </tr>
                        </tbody>
                        <tr>
                            <td colspan="8" style="padding: 4px;">
                                <table class="layui-table" style="text-align: center;margin: 0px">
                                    <thead>
                                    <tr>
                                        <th style="text-align: center"></th>
                                        <th style="text-align: center">商品图片</th>
                                        <th style="text-align: center">商品编码</th>
                                        <th style="text-align: center">商品名称</th>
                                        <th style="text-align: center">UPC(69)码</th>
                                        <th style="text-align: center">规格</th>
                                        <th style="text-align: center">执行价</th>
                                        <th style="text-align: center">记账价</th>
                                        <th style="text-align: center">数量</th>
                                        <th style="text-align: center">记账价合计(元)</th>
                                    </tr>
                                    </thead>
                                    <tbody>
                                    {{#  layui.each(item.refundGoods, function(index, item2){ }}
                                    <tr>
                                        <td></td>
                                        <td><img src="{{item2.imgeUrl}}" width="40px" height="40px"></td>
                                        <td> {{item2.goodsCode}}</td>
                                        <td>{{item2.goodsName}}</td>
                                        <td>{{item2.mainBarcode?item2.mainBarcode:"无"}}</td>
                                        <td>{{item2.standard ?item2.standard:"无"}}</td>
                                        <td>{{item2.exercisePrice ? item2.exercisePrice : 0}}</td>
                                        <td>{{item2.accountPrice ? item2.accountPrice : 0}}</td>
                                        <td>{{item2.quantity ? item2.quantity : 0}}</td>
                                        <td>{{item2.quantity ? Math.round(accMul(accMul(item2.quantity , (item2.accountPrice ? item2.accountPrice : 0)),100))/100 : 0}}</td>
                                    </tr>
                                    {{# }); }}
                                    </tbody>
                                </table>
                            </td>
                        </tr>
                        <tr>
                            <td colspan="8"></td>
                        </tr>
                        {{# }); }}
                    </table>
                </td>
            </tr>
            </tbody>
        </table>
    </div>
</script>

<!-- 物流详情-->
<script type="text/html" id="logisticsInfotpl">
    <div class="panel panel-default">
        {{# layui.each(d, function(i, r){ }}
        <div id="vertical-timeline" class="vertical-container dark-timeline">
            <div class="vertical-timeline-block" style="padding: 0px;margin-bottom: 10px;margin-top: 10px">
                <div class="vertical-timeline-icon navy-bg">
                    <i class="fa fa-commenting-o"></i>
                </div>
                <div class="vertical-timeline-content" style="padding: 4px;">
                    <p data-toggle="collapse" data-target="#collapse{{i}}"> &nbsp;<b>物流公司：{{r.logisticsName ?
                        r.logisticsName:"无"}}</b> &nbsp; &nbsp;<b>运单号：{{r.waybillCode?r.waybillCode:"无"}}</b>
                        &nbsp; &nbsp;{{# if(i==0){ }}<b>配送状态：{{r.deliveryStatusDesc?r.deliveryStatusDesc:"无"}}</b>{{# }
                        }}</p>
                </div>
            </div>
            {{# if(i==0){ }}
            <div id="collapse{{i}}" class="collapse in">
                {{# }else{ }}
                <div id="collapse{{i}}" class="collapse">
                    {{# } }}
                    {{# layui.each(r.traceInfos, function(index, item){ }}
                    <div class="vertical-timeline-block" style="padding: 0px;margin-bottom:10px;margin-top: 10px">
                        <div class="vertical-timeline-icon navy-bg">
                            <i class="fa fa-truck"></i>
                        </div>
                        <div class="vertical-timeline-content" style="padding: 2px">
                            <p style="margin-bottom: 1px;padding-bottom: 12px;"> {{item.nodeDesc ? item.nodeDesc:""}}
                                &nbsp;&nbsp;&nbsp;&nbsp;<b>{{item.nodeTime
                                    ? item.nodeTime :""}} </b></p>
                        </div>
                    </div>
                    {{# }); }}
                </div>
                {{# }); }}
            </div>
        </div>
</script>

<!-- 完善信息 -->
<script type="text/html" id="fillingCustomerInfoTpl">
    <form class="form-horizontal" id="fillingCustomerInfoForm" style="padding:10px;">
        <div id="fillingCustomerInfoDiv" class="col-md-12">
            <div class="form-group">
                <label class="col-sm-3 control-label">姓名</label>
                <div class="col-sm-9">
                    <input name="receiverName" id="receiverNameFill" class="form-control" type="text"
                           value="{{d.name ? d.name:''}}" {{d.name? 'disabled':''}}>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">电话</label>
                <div class="col-sm-9">
                    <input name="receiverPhone" id="receiverPhoneFill" class="form-control" type="text"
                           value="{{d.phone ? d.phone:''}}" {{d.phone&&d.phoneTest? 'disabled':''}}>
                </div>
            </div>
            <div class="form-group">9
                <label class="col-sm-3 control-label">身份证</label>
                <div class="col-sm-9">
                    <input name="receiverIdCard" id="receiverIdCardFill" class="form-control" type="text"
                           value="{{d.idCard ? d.idCard:''}}" {{d.idCard? 'disabled':''}}>
                </div>
            </div>

            <div class="form-group">
                <label class="col-sm-3 control-label">备注</label>
                <div class="col-sm-9">
                    <textarea name="receiverRemark" id="receiverRemark" class="form-control" placeholder="请输入备注"  cols="30" rows="2">{{d.remark ? d.remark:''}}</textarea>
                </div>
            </div>
        </div>
        <input name="requireAll" class="form-control" type="hidden"
               value="{{d.idCard&&d.phone&&d.phoneTest&&d.name ? '1':'0'}}">
    </form>
</script>

<!--下账模版 start-->
<script type="text/html" id="postingTpl">
    <div id="postingDiv" style="padding: 10px">
        <table class="layui-table">
            <tbody>
            <tr>
                <td class="layui-table-td-bg">小票序号:</td>
                <td class="text-center" id="pTicketNum">  {{d.ticketNum ? d.ticketNum :"-" }}    </td>
                <td class="layui-table-td-bg">订单编码:</td>
                <td class="text-center">  {{d.orderCode ? d.orderCode :"-" }}    </td>
            </tr>
            {{# if(!d.prescription && d.orderCode.indexOf('WXM')==0 ){  }}
            <tr>
                <td class="layui-table-td-bg">收货人:</td>
                <td class="text-center" id="pReceiverName">{{d.receiverName ? d.receiverName :"-" }}</td>
                <td class="layui-table-td-bg">收货电话:</td>
                <td class="text-center" id="pReceiverPhone">{{d.receiverPhone ? d.receiverPhone :"-" }}</td>

            </tr>
            <tr>
                <td class="layui-table-td-bg">患者姓名:</td>
                <td><div style="width:100%;"><input  id="patientName" class="form-control" style="text-align: center" type="text" value="{{d.patientName ? d.patientName :'' }}"/></div></td>
                <td class="layui-table-td-bg">患者电话:</td>
                <td><div style="width:100%;"><input  id="patientPhone" class="form-control" style="text-align: center" type="text" value=""/></div></td>
            </tr>
            <tr>
                <td class="layui-table-td-bg">身份证:</td>
                <td><div style="width:100%;"><input  id="patientIDCard" class="form-control" style="text-align: center" type="text" value=""/></div></td>
                <td class="layui-table-td-bg">营业员:</td>
                <td class="text-center">
                    <select data-placeholder="请选择下账员工..." class="form-control" style="width:100%;text-align: center" tabindex="2"  name="" id="storeUserSelect">
                        <option value='' style="text-align: center">---请选择下账员工---</option>
                        {{#  layui.each(d.salesCodes, function(index, item){ }}
                        <option value={{item}} {{d.salesCode==item?"selected":""}} style="text-align: center">{{item}}</option>
                        {{# }); }}
                    </select>
                </td>
            </tr>

            <tr>
                <td class="layui-table-td-bg">患者年龄:</td>
                <td><div style="width:100%;"><input  id="patientAge" class="form-control" style="text-align: center" type="text" value=""/></div></td>
                <td class="layui-table-td-bg">患者性别:</td>
                <td class="layui-table-td-bg">
                    <input id="sexlable" type="radio" name="sex" value="MALE"> &nbsp;男&nbsp;
                    <input type="radio" name="sex" value="FEMALE"> &nbsp;女&nbsp;
                </td>
            </tr>

            <tr>
                <td class="layui-table-td-bg">患者地址:</td>
                <td colspan="3"><div style="width:100%;"><input  id="patientAddress" class="form-control" style="text-align: center" type="text" value="{{d.linkageAddress ? d.linkageAddress :'' }}"/></div></td>
            </tr>

            {{# }  else if(d.prescription){  }}
            <tr>
                <td class="layui-table-td-bg">收货人:</td>
                <td class="text-center" id="pReceiverName">{{d.receiverName ? d.receiverName :"-" }}</td>
                <td class="layui-table-td-bg">收货电话:</td>
                <td class="text-center" id="pReceiverPhone">{{d.receiverPhone ? d.receiverPhone :"-" }}</td>
            </tr>
            {{# if(d.prescriptId){  }}
            <tr>
                <td class="layui-table-td-bg">复核人:</td>
                <td><div style="width:100%;"><input  id="pReviewer" class="form-control" style="text-align: center" type="text" value="{{d.reviewer ? d.reviewer :'' }}"></div></td>
                <td class="layui-table-td-bg">调配人:</td>
                <td><div style="width:100%;"><input  id="pSaleMan" class="form-control" style="text-align: center" type="text" value="{{d.saleMan ? d.saleMan :'' }}"></div></td>
            </tr>
            <tr>
                <td class="layui-table-td-bg">患者姓名:</td>
                <td><div style="width:100%;"><input  id="patientName" class="form-control" style="text-align: center" type="text" value="{{d.patientName ? d.patientName :'' }}"/></div></td>
                <td class="layui-table-td-bg">患者电话:</td>
                <td><div style="width:100%;"><input  id="patientPhone" class="form-control" style="text-align: center" type="text" value=""/></div></td>
            </tr>
            <tr>
                <td class="layui-table-td-bg">身份证:</td>
                <td><div style="width:100%;"><input  id="patientIDCard" class="form-control" style="text-align: center" type="text" value=""/></div></td>
                <td class="layui-table-td-bg">营业员:</td>
                <td class="text-center">
                    <select data-placeholder="请选择下账员工..." class="form-control" style="width:100%;text-align: center" tabindex="2"  name="" id="storeUserSelect">
                        <option value='' style="text-align: center">---请选择下账员工---</option>
                        {{#  layui.each(d.salesCodes, function(index, item){ }}
                        <option value={{item}} {{d.salesCode==item?"selected":""}} style="text-align: center">{{item}}</option>
                        {{# }); }}
                    </select>
                </td>
            </tr>
            <tr>
                <td class="layui-table-td-bg">患者性别:</td>
                <td class="layui-table-td-bg">
                    <input id="sexlable"  type="radio" name="sex" value="MALE"  {{d.sex=='MALE'?"checked":""}}> &nbsp;男&nbsp;
                    <input type="radio" name="sex" value="FEMALE" {{d.sex=='FEMALE'?"checked":""}}> &nbsp;女&nbsp;
                </td>

                <td class="layui-table-td-bg">患者年龄:</td>
                <td><div style="width:100%;"><input  id="patientAge" class="form-control" style="text-align: center" type="text" value=""/></div></td>
            </tr>

            <tr>
                <td class="layui-table-td-bg">患者地址:</td>
                <td colspan="3"><div style="width:100%;"><input  id="patientAddress" class="form-control" style="text-align: center" type="text" value="{{d.linkageAddress ? d.linkageAddress :'' }}"/></div></td>
            </tr>

            {{# } else { }}
            <tr>
                <td class="layui-table-td-bg">审方员:</td>
                <td><div style="width:100%;"><input  id="pPrescriptor" class="form-control" style="text-align: center" type="text" value="{{d.prescriptor ? d.prescriptor :'' }}"></div></td>
                <td class="layui-table-td-bg">调配人:</td>
                <td><div style="width:100%;"><input  id="pSaleMan" class="form-control" style="text-align: center" type="text" value="{{d.saleMan ? d.saleMan :'' }}"></div></td>
            </tr>
            <tr>
                <td class="layui-table-td-bg">复核人:</td>
                <td><div style="width:100%;"><input  id="pReviewer" class="form-control" style="text-align: center" type="text" value="{{d.reviewer ? d.reviewer :'' }}"></div></td>
                <td class="layui-table-td-bg">患者姓名:</td>
                <td><div style="width:100%;"><input  id="patientName" class="form-control" style="text-align: center" type="text" value="{{d.patientName ? d.patientName :'' }}"/></div></td>
            </tr>
            <tr>
                <td class="layui-table-td-bg">患者电话:</td>
                <td><div style="width:100%;"><input  id="patientPhone" class="form-control" style="text-align: center" type="text" value=""/></div></td>
                <td class="layui-table-td-bg">身份证:</td>
                <td><div style="width:100%;"><input  id="patientIDCard" class="form-control" style="text-align: center" type="text" value=""/></div></td>
            </tr>
            <tr>
                <td class="layui-table-td-bg">营业员:</td>
                <td class="text-center">
                    <select data-placeholder="请选择下账员工..." class="form-control" style="width:100%;text-align: center" tabindex="2"  name="" id="storeUserSelect">
                        <option value='' style="text-align: center">---请选择下账员工---</option>
                        {{#  layui.each(d.salesCodes, function(index, item){ }}
                        <option value={{item}} {{d.salesCode==item?"selected":""}} style="text-align: center">{{item}}</option>
                        {{# }); }}
                    </select>
                </td>
                <td class="layui-table-td-bg">患者性别:</td>
                <td class="layui-table-td-bg">
                    <input id="sexlable"  type="radio" name="sex" value="MALE"  {{d.sex=='MALE'?"checked":""}}> &nbsp;男&nbsp;
                    <input type="radio" name="sex" value="FEMALE" {{d.sex=='FEMALE'?"checked":""}}> &nbsp;女&nbsp;
                </td>
            </tr>

            <tr>
                <td class="layui-table-td-bg">患者年龄:</td>
                <td><div style="width:100%;"><input  id="patientAge" class="form-control" style="text-align: center" type="text" value=""/></div></td>
            </tr>

            <tr>
                <td class="layui-table-td-bg">患者地址:</td>
                <td colspan="3"><div style="width:100%;"><input  id="patientAddress" class="form-control" style="text-align: center" type="text" value="{{d.linkageAddress ? d.linkageAddress :'' }}"/></div></td>
            </tr>
            {{# }  }}
            {{# } else{ }}
            <tr>
                <td class="layui-table-td-bg">营业员:</td>
                <td class="text-center">
                    <select data-placeholder="请选择下账员工..." class="form-control" style="width:100%;text-align: center" tabindex="2"  name="" id="storeUserSelect">
                        <option value='' style="text-align: center">---请选择下账员工---</option>
                        {{#  layui.each(d.salesCodes, function(index, item){ }}
                        <option value={{item}} {{d.salesCode==item?"selected":""}} style="text-align: center">{{item}}</option>
                        {{# }); }}
                    </select>
                </td>
            </tr>
            {{# }  }}
            <tr>
                <td class="layui-table-td-bg" style="display: none" id = "otherStoreUserLabel">员工:</td>
                <td style="display: none" id ="otherStoreUserInput"><div style="width:100%;" ><input  id="otherStoreUser" placeholder="格式：姓名-工号" class="form-control" style="text-align: center" type="text"></div></td>
            </tr>
            <!-- add by zhouwenkai start  三类医疗器械下账补全信息 -->
            {{# if(d.instrument === 'Y'){  }}
            <tr>
                <td class="layui-table-td-bg">顾客姓名:</td>
                <td><div style="width:100%;"><input  id="customerName" class="form-control" style="text-align: center" type="text" value=""/></div></td>
                <td class="layui-table-td-bg">联系方式:</td>
                <td><div style="width:100%;"><input  id="customerPhone" class="form-control" style="text-align: center" type="text" value=""/></div></td>
            </tr>
            {{# }  }}

            <input  id="prescriptionFlag"  type="hidden" value="{{d.prescription ? d.prescription :'' }}"/>
            <input  id="instrumentFlag"  type="hidden" value="{{d.instrument ? d.instrument :'' }}"/>

            <!-- add by zhouwenkai end-->

            <table id="goodsInfo" class="layui-table" style="text-align: center;margin: 0px">
                <thead>
                <tr>
                    <th data-align="center" style="text-align: center" data-field="goodsCode" data-width="225px">商品编码</th>
                    <th data-align="center" style="text-align: center" data-field="goodsName">商品名称</th>
                    <th data-align="center" style="text-align: center" data-field="goodsAmount">商品数量</th>
                    <th data-align="center" style="text-align: center" data-field="lotNum">批次号</th>
                    <th data-align="center" style="text-align: center" data-field="amount">数量</th>
                    <th data-align="center" style="text-align: center" data-field="exercisePrice">价格</th>
                    <th data-align="center" style="text-align: center" data-field="insertOrDelete">操作</th>
                </tr>
                </thead>
                <tbody>
                {{#  layui.each(d.lotInfoList, function(index, item){ }}
                <tr>
                    <td>{{item.goodsCode }}</td>
                    <td>{{item.goodsName}}</td>
                    <td>{{item.goodsAmount}}</td>
                    <td>
                        {{# if(item.lotNum.length>0){ }}
                        <select style="width:100%" name="lotNumSelect" class="form-control">
                            {{#  layui.each(item.lotNum, function(index, item){ }}
                            <option value = {{item}}>{{item}}</option>
                            {{# }); }}
                        </select>
                        {{# } }}

                        {{# if(item.lotNum.length==0){ }}
                        <select style="width:100%" name="lotNumSelect" class="form-control">
                            <option value = ''>
                                --无批次信息--
                            </option>
                        </select>
                        {{# }  }}
                    </td>
                    <td>
                        {{# if(item.lotNum.length>0){ }}
                        <select style="width:100%" name="amountSelect" class="form-control">
                            {{#  layui.each(item.amount, function(index, item){ }}
                            <option value = {{item}}>
                                {{item}}
                            </option>
                            {{# }); }}
                        </select>
                        {{# } }}
                        {{# if(item.lotNum.length==0){ }}
                        <select style="width:100%" name="amountSelect" class="form-control">
                            <option value = {{item}}>
                                --请选择--
                            </option>
                        </select>
                        {{# }  }}
                    </td>
                    <td>{{item.exercisePrice}}</td>
                    <td hidden="hidden">{{item.accountPrice}}</td>
                    <td>
                        <button type="button" class="btn btn-outline btn-success btn-xs" onclick="javascript:addRowsData(this,this.parentNode.parentNode)">新增</button>
                        <button type="button" class="btn btn-outline btn-default btn-xs" disabled="disabled" onclick="javascript:deleteRowsData(this.parentNode.parentNode)">删除</button>
                    </td>
                </tr>
                {{# }); }}
                </thead>
            </table>

            <br/>
            <div class="form-group">
                <div class="col-sm-4">

                </div>
                <div class="col-sm-2">
                    <button type="button" class="btn btn-success" onclick="submitKeepAccount()"> 确定</button>
                </div>
                <div class="col-sm-2">
                    <button type="button" class="btn btn-default" onclick="javascript:layer.closeAll()"> 取消</button>
                </div>
                <div class="col-sm-4"></div>
            </div>
            <br/><br/><br/>
            </tbody>
        </table>
    </div>
</script>

<!--智能门店协调确定协调批号模版-->
<script type="text/html" id="createCoordinateOrderModel">
    <div id="coordinateDiv" style="padding: 10px">
        <table class="layui-table">
            <tbody>
            <tr>
                <td class="layui-table-td-bg">小票序号:</td>
                <td class="text-center" id="posTicketNum">  {{d.ticketNum ? d.ticketNum :"-" }}    </td>
                <td class="layui-table-td-bg">订单编码:</td>
                <td class="text-center">  {{d.orderCode ? d.orderCode :"-" }}    </td>
            </tr>
            <tr>
                <td class="layui-table-td-bg">收货人:</td>
                <td class="text-center" id="posReceiverName">{{d.receiverName ? d.receiverName :"-" }}</td>
                <td class="layui-table-td-bg">收货电话:</td>
                <td class="text-center" id="posReceiverPhone">{{d.receiverPhone ? d.receiverPhone :"-" }}</td>

            </tr>
            <tr>
                <td class="layui-table-td-bg">营业员:</td>
                <td class="text-center">
                    <select data-placeholder="请选择下账员工..." class="form-control" style="width:100%;text-align: center" tabindex="2"  name="" id="posStoreUserSelect">
                        <option value='' style="text-align: center">---请选择下账员工---</option>
                        {{#  layui.each(d.salesCodes, function(index, item){ }}
                        <option value={{item}} style="text-align: center">{{item}}</option>
                        {{# }); }}
                    </select>
                </td>
                <td class="layui-table-td-bg"></td>
                <td class="text-center"></td>
            </tr>

            <tr>
                <td class="layui-table-td-bg" style="display: none" id = "posOtherStoreUserLabel">员工:</td>
                <td style="display: none" id ="posOtherStoreUserInput"><div style="width:100%;" ><input  id="posOtherStoreUser" placeholder="格式：姓名-工号" class="form-control" style="text-align: center" type="text"></div></td>
            </tr>

            <table id="posGoodsInfo" class="layui-table" style="text-align: center;margin: 0px">
                <thead>
                <tr>
                    <th data-align="center" style="text-align: center" data-field="goodsCode" data-width="225px">商品编码</th>
                    <th data-align="center" style="text-align: center" data-field="goodsName">商品名称</th>
                    <th data-align="center" style="text-align: center" data-field="goodsAmount">商品数量</th>
                    <th data-align="center" style="text-align: center" data-field="lotNum">批次号</th>
                    <th data-align="center" style="text-align: center" data-field="amount">数量</th>
                    <th data-align="center" style="text-align: center" data-field="accountPrice">价格</th>
                    <th hidden="hidden" data-align="center" style="text-align: center" data-field="exercisePrice">执行价</th>
                    <th data-align="center" style="text-align: center" data-field="insertOrDelete">操作</th>
                </tr>
                </thead>
                <tbody>
                {{#  layui.each(d.lotInfoList, function(index, item){ }}
                <tr>
                    <td>{{item.goodsCode }}</td>
                    <td>{{item.goodsName}}</td>
                    <td>{{item.goodsAmount}}</td>
                    <td>
                        {{# if(item.lotNum.length>0){ }}
                        <select style="width:100%" name="posLotNumSelect" class="form-control">
                            {{#  layui.each(item.lotNum, function(index, item){ }}
                            <option value = {{item}}>{{item}}</option>
                            {{# }); }}
                        </select>
                        {{# } }}

                        {{# if(item.lotNum.length==0){ }}
                        <select style="width:100%" name="posLotNumSelect" class="form-control">
                            <option value = ''>
                                --无批次信息--
                            </option>
                        </select>
                        {{# }  }}
                    </td>
                    <td>
                        {{# if(item.lotNum.length>0){ }}
                        <select style="width:100%" name="posAmountSelect" class="form-control">
                            {{#  layui.each(item.amount, function(index, item){ }}
                            <option value = {{item}}>
                                {{item}}
                            </option>
                            {{# }); }}
                        </select>
                        {{# } }}
                        {{# if(item.lotNum.length==0){ }}
                        <select style="width:100%" name="posAmountSelect" class="form-control">
                            <option value = {{item}}>
                                --请选择--
                            </option>
                        </select>
                        {{# }  }}
                    </td>
                    <td>{{item.accountPrice}}</td>
                    <td hidden="hidden">{{item.exercisePrice}}</td>
                    <td>
                        <button type="button" class="btn btn-outline btn-success btn-xs" onclick="javascript:addRowsData(this,this.parentNode.parentNode)">新增</button>
                        <button type="button" class="btn btn-outline btn-default btn-xs" disabled="disabled" onclick="javascript:deleteRowsData(this.parentNode.parentNode)">删除</button>
                    </td>
                </tr>
                {{# }); }}
                </thead>
            </table>

            <br/>
            <div class="form-group">
                <div class="col-sm-4">

                </div>
                <div class="col-sm-2">
                    <button type="button" class="btn btn-success" onclick="sumitCreateXTOrder()"> 确定</button>
                </div>
                <div class="col-sm-2">
                    <button type="button" class="btn btn-default" onclick="javascript:layer.closeAll()"> 取消</button>
                </div>
                <div class="col-sm-4"></div>
            </div>
            <br/><br/><br/>
            </tbody>
        </table>
    </div>
</script>

<!--自动确定协调批号模版-->
<script type="text/html" id="autoCreateConsortModel">
    <div id="autoCreateConsortDiv" style="padding: 10px">
        <table class="layui-table">
            <tbody>
            <tr>
                <td class="layui-table-td-bg">营业员:</td>
                <td class="text-center">
                    <select data-placeholder="请选择营业员..." class="form-control" style="width:100%;text-align: center" tabindex="2"  name="" id="autoCreateConsortUserSelect">
                        <option value='' style="text-align: center">---请选择营业员---</option>
                        {{#  layui.each(d.salesCodes, function(index, item){ }}
                        <option value={{item}} style="text-align: center">{{item}}</option>
                        {{# }); }}
                    </select>
                </td>
            </tr>
            <!--           <tr>
                           <td class="layui-table-td-bg" style="display: none" id = "posOtherStoreUserLabel">员工:</td>
                           <td style="display: none" id ="posOtherStoreUserInput"><div style="width:100%;" ><input  id="posOtherStoreUser" placeholder="格式：姓名-工号" class="form-control" style="text-align: center" type="text"></div></td>
                       </tr>-->
            <table id="posGoodsInfo" class="layui-table" style="text-align: center;margin: 0px">
            </table>
            <br/>
            <div class="form-group">
                <div class="col-sm-4">
                </div>
                <div class="col-sm-2">
                    <button type="button" class="btn btn-success" onclick="submitAutoCreateConsort('{{d.orderCode}}')"> 确定</button>
                </div>
                <div class="col-sm-2">
                    <button type="button" class="btn btn-default" onclick="javascript:layer.closeAll()"> 取消</button>
                </div>
                <div class="col-sm-4"></div>
            </div>
            </tbody>
        </table>
    </div>
</script>

<!--协调单拒绝发货模版-->
<script type="text/html" id="goBackModel">
    <form class="form-horizontal" id="goBackForm">
        <div class="col-md-12" style="width: 400px;margin-top: 20px;height: 180px;">
            <div class="form-group" >
                <label class="col-sm-4 control-label"><font color="red" >* </font>拒绝原因：</label>
                <div class="col-sm-8">
                    <select data-placeholder="请选择拒绝原因..." class="form-control" style="width:100%;text-align: center"
                            tabindex="2" name="" id="goBackReasonSelect">
                        <option value='' style="text-align: center">---请选择拒绝原因---</option>
                        <option value='商品无库存' style="text-align: center">商品无库存</option>
                        <option value='商品已预订' style="text-align: center">商品已预订</option>
                        <option value='商品已损坏' style="text-align: center">商品已损坏</option>
                        <option value='other' style="text-align: center">其他</option>
                    </select>
                </div>
            </div>
            <div class="form-group" style="display: none" id="goBackOtherReasonDiv">
                <label class="col-sm-4 control-label">其他原因：</label>
                <div class="col-sm-8">
                    <textarea id="goBackOtherReasonInput" placeholder="请输入拒绝原因" class="form-control" ></textarea>
                </div>
            </div>
            <div  class="form-group">
                <label class="col-sm-4 control-label"></label>
                <div class="col-sm-8">
                    <span style="color: red">说明：公司将考核拒绝发货数据</span>
                </div>
            </div>
            <div class="form-group">
                <div class="col-sm-2"></div>
                <div class="col-sm-5 text-right">
                    <button type="button" class="btn btn-success" onclick="submitGoBack('{{d.orderCode}}')"> 确定</button>
                </div>
                <div class="col-sm-5 text-left">
                    <button type="button" class="btn btn-default" onclick="javascript:layer.closeAll()"> 取消</button>
                </div>
            </div>
        </div>
    </form>
</script>

<!--调货单拒绝调货模版-->
<script type="text/html" id="rejectTransferModel">
    <form class="form-horizontal" id="rejectTransferForm">
        <div class="col-md-12" style="width: 400px;margin-top: 20px;height: 180px;">
            <div class="form-group" >
                <label class="col-sm-4 control-label"><font color="red" >* </font>拒绝原因：</label>
                <div class="col-sm-8">
                    <select data-placeholder="请选择拒绝原因..." class="form-control" style="width:100%;text-align: center"
                            tabindex="2" name="" id="rejectTransferReasonSelect">
                        <option value='' style="text-align: center">---请选择退货原因---</option>
                        <option value='商品无库存' style="text-align: center">商品无库存</option>
                        <option value='商品已预订' style="text-align: center">商品已预订</option>
                        <option value='商品已损坏' style="text-align: center">商品已损坏</option>
                        <option value='other' style="text-align: center">其他</option>
                    </select>
                </div>
            </div>
            <div class="form-group" style="display: none" id="rejectTransferOtherReasonDiv">
                <label class="col-sm-4 control-label">其他原因：</label>
                <div class="col-sm-8">
                    <textarea id="rejectTransferOtherReasonInput" placeholder="请输入退回原因" class="form-control" ></textarea>
                </div>
            </div>
            <div class="form-group">
                <div class="col-sm-2"></div>
                <div class="col-sm-5 text-right">
                    <button type="button" class="btn btn-success" onclick="submitRejectTransfer('{{d.orderCode}}')"> 确定</button>
                </div>
                <div class="col-sm-5 text-left">
                    <button type="button" class="btn btn-default" onclick="javascript:layer.closeAll()"> 取消</button>
                </div>
            </div>
        </div>
    </form>
</script>

<!-- 退货详情-
<script type="text/html" id="returnOrderTpl">
        <div id="returnOrderPickDiv" style="padding: 15px">
            <table class="layui-table" style="text-align: center;margin: 0px">
                <thead>
                    <tr>
                        <th style="text-align: center">商品图片</th>
                        <th style="text-align: center">商品编码</th>
                        <th style="text-align: center">商品名称</th>
                        <th style="text-align: center">UPC(69)码</th>
                        <th style="text-align: center">规格</th>
                        <th style="text-align: center">执行价</th>
                        <th style="text-align: center">记账价</th>
                        <th style="text-align: center">退货数量</th>
                        <th style="text-align: center">记账价合计(元)</th>
                    </tr>
                </thead>
                <tbody>
                {{#
                    var pct = 0;
                    layui.each(d.refundingGoodsList, function(index, item){
                    pct += ((item.accountPrice ?item.accountPrice:0) * item.quantity);
                }}
                <tr>
                    <td><img src="{{item.imgeUrl}}" width="40px" height="40px"></td>
                    <td> {{item.goodsCode ? item.goodsCode : "-"}}</td>
                    <td>{{item.goodsName ? item.goodsName : "-"}}</td>
                    <td>{{item.mainBarcode ? item.mainBarcode :"无"}}</td>
                    <td>{{item.standard ? item.standard :"无"}}</td>
                    <td>{{item.exercisePrice ? item.exercisePrice : "0"}}</td>
                    <td>{{item.accountPrice ? item.accountPrice : "0"}}</td>
                    <td>{{item.quantity ? item.quantity : "0"}}</td>
                    <td>{{item.quantity ? Math.round(accMul(accMul(item.quantity , (item.accountPrice ? item.accountPrice : 0)),100))/100 : 0}}</td>
                </tr>
                {{# }); }}
                <tr>
                    <td colspan="9" style="text-align: right;">退款商品总价：{{d.refundAmount ? d.refundAmount : 0}}</td>
                </tr>
                <tr>
                    <td>
                        是否退运费：
                    </td>
                    <td colspan="8" style="text-align: left;">
                        <input type="hidden" name="returnOderCode" value="{{d.orderCode}}" id="returnOderCode">
                        <input type="radio" name="isReturnFreight" id="returnFreight_0" value="true" {{d.refundOrder.isRefundFreight === 'Y' ? 'checked' : ''}} disabled="disabled"><label for="returnFreight_0">退运费</label>&nbsp;&nbsp;&nbsp;&nbsp;
                        <input type="radio" name="isReturnFreight" id="returnFreight_1" value="false" {{d.refundOrder.isRefundFreight === 'N' ? 'checked' : ''}} disabled="disabled"><label for="returnFreight_1">不退运费</label>
                    </td>
                </tr>
                <tr>
                    <td>
                        顾客退货理由：
                    </td>
                    <td colspan="8" style="text-align: left;">
                        <textarea rows="5" cols="30" style="width: 100%;" id="returnReason" disabled="disabled">{{d.refundOrder.reason ? d.refundOrder.reason : ''}}</textarea>
                </tr>
                </tbody>
            </table>
        </div>
    </script>
-->
<!-- 仓库详情 -->
<script type="text/html" id="warehouseDetail">
    <div id="warehouseDetailPickDiv" style="padding: 10px">
        <table class="layui-table">
            <tbody>
            <tr>
                <td class="layui-table-td-bg">仓库编码</td>
                <td class="text-center">{{d.warehouseCode ? d.warehouseCode :"" }}</td>
                <td class="layui-table-td-bg">仓库名称</td>
                <td class="text-center">{{d.name ? d.name :"" }}</td>
            </tr>
            <tr>
                <td class="layui-table-td-bg">仓库类型</td>
                <td class="text-center" >{{d.type ? d.type :"" }}</td>
                <td class="layui-table-td-bg">描述</td>
                <td class="text-center">{{d.remark ? d.remark :"" }}</td>
            </tr>
            <tr>
                <td class="layui-table-td-bg">仓库地址</td>
                <td class="text-center">{{d.address ? d.address :"" }}</td>
                <td class="layui-table-td-bg">区域编码</td>
                <td class="text-center">{{d.regionCode ? d.regionCode :"" }}</td>
            </tr>
            <tr>
                <td class="layui-table-td-bg">经度</td>
                <td class="text-center">{{d.longitude ? d.longitude :"" }}</td>
                <td class="layui-table-td-bg">纬度</td>
                <td class="text-center">{{d.latitude ? d.latitude :"" }}</td>
            </tr>
            <tr>
                <td class="layui-table-td-bg">电话</td>
                <td class="text-center">{{d.phone ? d.phone :"" }}</td>
                <td class="layui-table-td-bg">状态</td>
                <td class="text-center" >{{d.status ? d.status :"" }}</td>
            </tr>
            </tbody>
        </table>
    </div>
</script>

<!--自动下账模版 start-->
<script type="text/html" id="autoCreatePostingModel">
    <div id="autoCreatePostingDiv" style="padding: 10px">
        <table class="layui-table">
            <tbody>
            <tr hidden="hidden">
                <td class="layui-table-td-bg">小票序号:</td>
                <td class="text-center" id="ticketNum">  {{d.ticketNum ? d.ticketNum :"-" }}    </td>
                <td class="layui-table-td-bg">订单编码:</td>
                <td class="text-center">  {{d.orderCode ? d.orderCode :"-" }}    </td>
            </tr>
            {{# if(!d.prescription && d.orderCode.indexOf('WXM')==0 ){  }}
            <tr>
                <td class="layui-table-td-bg">收货人:</td>
                <td class="text-center" id="receiverName">{{d.receiverName ? d.receiverName :"-" }}</td>
                <td class="layui-table-td-bg">收货电话:</td>
                <td class="text-center" id="receiverPhone">{{d.receiverPhone ? d.receiverPhone :"-" }}</td>
            </tr>
            <tr>
                <td class="layui-table-td-bg">患者姓名:</td>
                <td><div style="width:100%;"><input  id="autoPatientName" class="form-control" style="text-align: center" type="text" value="{{d.patientName ? d.patientName :'' }}"/></div></td>
                <td class="layui-table-td-bg">患者电话:</td>
                <td><div style="width:100%;"><input  id="autoPatientPhone" class="form-control" style="text-align: center" type="text" value=""/></div></td>
            </tr>
            <tr>
                <td class="layui-table-td-bg">身份证:</td>
                <td><div style="width:100%;"><input  id="autoPatientIDCard" class="form-control" style="text-align: center" type="text" value=""/></div></td>
                <td class="layui-table-td-bg">营业员:</td>
                <td class="text-center">
                    <select data-placeholder="请选择下账员工..." class="form-control" style="width:100%;text-align: center" tabindex="2"  name="" id="autoStoreUserSelect">
                        <option value='' style="text-align: center">---请选择下账员工---</option>
                        {{#  layui.each(d.salesCodes, function(index, item){ }}
                        <option value={{item}} style="text-align: center">{{item}}</option>
                        {{# }); }}
                    </select>
                </td>
            </tr>

            <tr>
                <td class="layui-table-td-bg">患者年龄:</td>
                <td><div style="width:100%;"><input  id="patientAge" class="form-control" style="text-align: center" type="text" value=""/></div></td>
                <td class="layui-table-td-bg">患者性别:</td>
                <td class="layui-table-td-bg">
                    <input  id="sexlable" type="radio" name="sex" value="MALE"> &nbsp;男&nbsp;
                    <input type="radio" name="sex" value="FEMALE"> &nbsp;女&nbsp;
                </td>
            </tr>

            <tr>
                <td class="layui-table-td-bg">患者地址:</td>
                <td colspan="3"><div style="width:100%;"><input  id="patientAddress" class="form-control" style="text-align: center" type="text" value="{{d.linkageAddress ? d.linkageAddress :'' }}"/></div></td>
            </tr>

            {{# }  else if(d.prescription){  }}
            <tr>
                <td class="layui-table-td-bg">收货人:</td>
                <td class="text-center" id="receiverName">{{d.receiverName ? d.receiverName :"-" }}</td>
                <td class="layui-table-td-bg">收货电话:</td>
                <td class="text-center" id="receiverPhone">{{d.receiverPhone ? d.receiverPhone :"-" }}</td>
            </tr>
            {{# if(d.prescriptId){  }}
            <tr>
                <td class="layui-table-td-bg">复核人:</td>
                <td><div style="width:100%;"><input  id="pReviewer" class="form-control" style="text-align: center" type="text" value="{{d.reviewer ? d.reviewer :'' }}"></div></td>
                <td class="layui-table-td-bg">调配人:</td>
                <td><div style="width:100%;"><input  id="pSaleMan" class="form-control" style="text-align: center" type="text" value="{{d.saleMan ? d.saleMan :'' }}"></div></td>
            </tr>
            <tr>
                <td class="layui-table-td-bg">患者姓名:</td>
                <td><div style="width:100%;"><input  id="autoPatientName" class="form-control" style="text-align: center" type="text" value="{{d.patientName ? d.patientName :'' }}"/></div></td>
                <td class="layui-table-td-bg">患者电话:</td>
                <td><div style="width:100%;"><input  id="autoPatientPhone" class="form-control" style="text-align: center" type="text" value=""/></div></td>
            </tr>
            <tr>
                <td class="layui-table-td-bg">身份证:</td>
                <td><div style="width:100%;"><input  id="autoPatientIDCard" class="form-control" style="text-align: center" type="text" value=""/></div></td>
                <td class="layui-table-td-bg">营业员:</td>
                <td class="text-center">
                    <select data-placeholder="请选择下账员工..." class="form-control" style="width:100%;text-align: center" tabindex="2"  name="" id="autoStoreUserSelect">
                        <option value='' style="text-align: center">---请选择下账员工---</option>
                        {{#  layui.each(d.salesCodes, function(index, item){ }}
                        <option value={{item}} style="text-align: center">{{item}}</option>
                        {{# }); }}
                    </select>
                </td>
            </tr>
            <tr>
                <td class="layui-table-td-bg">患者性别:</td>
                <td class="layui-table-td-bg">
                    <input id="sexlable" type="radio" name="sex" value="MALE"  {{d.sex=='MALE'?"checked":""}}> &nbsp;男&nbsp;
                    <input type="radio" name="sex" value="FEMALE" {{d.sex=='FEMALE'?"checked":""}}> &nbsp;女&nbsp;
                </td>

                <td class="layui-table-td-bg">患者年龄:</td>
                <td><div style="width:100%;"><input  id="patientAge" class="form-control" style="text-align: center" type="text" value=""/></div></td>

            </tr>

            <tr>
                <td class="layui-table-td-bg">患者地址:</td>
                <td colspan="3"><div style="width:100%;"><input  id="patientAddress" class="form-control" style="text-align: center" type="text" value="{{d.linkageAddress ? d.linkageAddress :'' }}"/></div></td>
            </tr>
            {{# } else { }}
            <tr>
                <td class="layui-table-td-bg">审方员:</td>
                <td><div style="width:100%;"><input  id="pPrescriptor" class="form-control" style="text-align: center" type="text" value="{{d.prescriptor ? d.prescriptor :'' }}"></div></td>
                <td class="layui-table-td-bg">调配人:</td>
                <td><div style="width:100%;"><input  id="pSaleMan" class="form-control" style="text-align: center" type="text" value="{{d.saleMan ? d.saleMan :'' }}"></div></td>
            </tr>
            <tr>
                <td class="layui-table-td-bg">复核人:</td>
                <td><div style="width:100%;"><input  id="pReviewer" class="form-control" style="text-align: center" type="text" value="{{d.reviewer ? d.reviewer :'' }}"></div></td>
                <td class="layui-table-td-bg">患者姓名:</td>
                <td><div style="width:100%;"><input  id="autoPatientName" class="form-control" style="text-align: center" type="text" value="{{d.patientName ? d.patientName :'' }}"/></div></td>
            </tr>
            <tr>
                <td class="layui-table-td-bg">患者电话:</td>
                <td><div style="width:100%;"><input  id="autoPatientPhone" class="form-control" style="text-align: center" type="text" value=""/></div></td>
                <td class="layui-table-td-bg">身份证:</td>
                <td><div style="width:100%;"><input  id="autoPatientIDCard" class="form-control" style="text-align: center" type="text" value=""/></div></td>
            </tr>
            <tr>
                <td class="layui-table-td-bg">营业员:</td>
                <td class="text-center">
                    <select data-placeholder="请选择下账员工..." class="form-control" style="width:100%;text-align: center" tabindex="2"  name="" id="autoStoreUserSelect">
                        <option value='' style="text-align: center">---请选择下账员工---</option>
                        {{#  layui.each(d.salesCodes, function(index, item){ }}
                        <option value={{item}} style="text-align: center">{{item}}</option>
                        {{# }); }}
                    </select>
                </td>
                <td class="layui-table-td-bg">患者性别:</td>
                <td class="layui-table-td-bg">
                    <input id="sexlable" type="radio" name="sex" value="MALE"  {{d.sex=='MALE'?"checked":""}}> &nbsp;男&nbsp;
                    <input type="radio" name="sex" value="FEMALE" {{d.sex=='FEMALE'?"checked":""}}> &nbsp;女&nbsp;
                </td>
            </tr>

            <tr>
                <td class="layui-table-td-bg">患者年龄:</td>
                <td><div style="width:100%;"><input  id="patientAge" class="form-control" style="text-align: center" type="text" value=""/></div></td>
            </tr>
            <tr>
                <td class="layui-table-td-bg">患者地址:</td>
                <td colspan="3"><div style="width:100%;"><input  id="patientAddress" class="form-control" style="text-align: center" type="text" value="{{d.linkageAddress ? d.linkageAddress :'' }}"/></div></td>
            </tr>

            {{# }  }}
            {{# }  else { }}
            <tr>
                <td class="layui-table-td-bg">营业员:</td>
                <td class="text-center">
                    <select data-placeholder="请选择下账员工..." class="form-control" style="width:100%;text-align: center" tabindex="2"  name="" id="autoStoreUserSelect">
                        <option value='' style="text-align: center">---请选择下账员工---</option>
                        {{#  layui.each(d.salesCodes, function(index, item){ }}
                        <option value={{item}} style="text-align: center">{{item}}</option>
                        {{# }); }}
                    </select>
                </td>
            </tr>
            {{# } }}
            <!--            <tr>
                            <td class="layui-table-td-bg" style="display: none" id = "otherStoreUserLabel">员工:</td>
                            <td style="display: none" id ="otherStoreUserInput"><div style="width:100%;" ><input  id="otherStoreUser" placeholder="格式：姓名-工号" class="form-control" style="text-align: center" type="text"></div></td>
                        </tr>-->


            <!-- add by zhouwenkai start  三类医疗器械下账补全信息 -->
            {{# if(d.instrument === 'Y'){  }}
            <tr>
                <td class="layui-table-td-bg">顾客姓名:</td>
                <td><div style="width:100%;"><input  id="customerName" class="form-control" style="text-align: center" type="text" value=""/></div></td>
                <td class="layui-table-td-bg">联系方式:</td>
                <td><div style="width:100%;"><input  id="customerPhone" class="form-control" style="text-align: center" type="text" value=""/></div></td>
            </tr>
            {{# }  }}

            <input  id="prescriptionFlag"  type="hidden" value="{{d.prescription ? d.prescription :'' }}"/>
            <input  id="instrumentFlag"  type="hidden" value="{{d.instrument ? d.instrument :'' }}"/>

            <!-- add by zhouwenkai end-->

            <table  class="layui-table" style="text-align: center;margin: 0px">
            </table>
            <br/>
            <div class="form-group">
                <div class="col-sm-4">
                </div>
                <div class="col-sm-2">
                    <button type="button" class="btn btn-success" onclick="submitAutoPosting('{{d.orderCode}}')"> 确定</button>
                </div>
                <div class="col-sm-2">
                    <button type="button" class="btn btn-default" onclick="javascript:layer.closeAll()"> 取消</button>
                </div>
                <div class="col-sm-4"></div>
            </div>
            <br/><br/><br/>
            </tbody>
        </table>
    </div>
</script>

<!-- 下账模块 -->

<!--打印小票选择营业员模板 start-->
<script type="text/html" id="salesCodesTpl">
    <div id="salesCodesDiv" style="padding: 5px">

        <div><img src="../../res/images/icon_17.png" height="34" width="34"/>请先完成拣货，确认订单内商品门店是否有实物库存</div>
        <table class="layui-table">
            <tbody>
            <div class="form-group">
                <tr hidden="hidden">
                    <td class="layui-table-td-bg">订单编码:</td>
                    <td class="text-center">  {{d.orderCode ? d.orderCode :"-" }}    </td>
                </tr>
                <tr>
                    <td class="layui-table-td-bg">营业员:</td>
                    <td class="text-center">
                        <select data-placeholder="请选择下账员工..." class="form-control" style="width:100%;text-align: center"
                                tabindex="2" name="" id="salesCodeSelect" required="true">
                            <option value='' style="text-align: center">---请选择下账员工---</option>
                            {{# layui.each(d, function(index, item){ }}
                            <option value={{item}} style="text-align: center">{{item}}</option>
                            {{# }); }}
                        </select>
                    </td>
                </tr>
                <table  class="layui-table" style="text-align: center;margin: 0px">
                </table>
            </div>
            <div class="form-group">
                <div class="col-sm-4">
                </div>
                <div class="col-sm-2">

                    <button type="button" class="btn btn-success" onclick="submitSalesCode('{{d.orderCode}}')"> 确定</button>
                </div>
                <div class="col-sm-2">
                    <button type="button" class="btn btn-default" onclick="javascript:layer.closeAll()"> 取消</button>
                </div>
                <div class="col-sm-4"></div>
            </div>
            <br/><br/><br/>
            </tbody>
        </table>
    </div>
</script>



<!--批量打印小票选择营业员模板 start-->
<script type="text/html" id="salesCodesTpl4BatchPrintlnTicket">
    <div id="salesCodesDiv4BatchPrintlnTicket" style="padding: 5px">
        <div><img src="../../res/images/icon_17.png" height="34" width="34"/>请先完成拣货，确认订单内商品门店是否有实物库存</div>
        <table class="layui-table">
            <tbody>
            <div class="form-group">
                <!--
                <tr hidden="hidden">
                    <td class="layui-table-td-bg">订单编码:</td>
                    <td class="text-center">  {{d.orderCode ? d.orderCode :"-" }}    </td>
                </tr>
                -->
                <tr>
                    <td class="layui-table-td-bg">营业员2:</td>
                    <td class="text-center">
                        <select data-placeholder="请选择下账员工..." class="form-control" style="width:100%;text-align: center"
                                tabindex="2" name="" id="salesCodeSelect4BatchPrintlnTicket" required="true">
                            <option value='' style="text-align: center">---请选择下账员工---</option>
                            {{# layui.each(d, function(index, item){ }}
                            <option value={{item}} style="text-align: center">{{item}}</option>
                            {{# }); }}
                        </select>
                    </td>
                </tr>
                <table  class="layui-table" style="text-align: center;margin: 0px">
                </table>
            </div>
            <div class="form-group">
                <div class="col-sm-4">
                </div>
                <div class="col-sm-2">

                    <button type="button" class="btn btn-success" onclick="batchPrintlnTicket()"> 确定</button>
                </div>
                <div class="col-sm-2">
                    <button type="button" class="btn btn-default" onclick="javascript:layer.closeAll()"> 取消</button>
                </div>
                <div class="col-sm-4"></div>
            </div>
            <br/><br/><br/>
            </tbody>
        </table>
    </div>
</script>




</body>
<script type="text/javascript">
    (function () {
        $.openx.loadScript(['../../res/plugins/yifeng/channel.js','../../js/order/pick.js','../../js/order/posChannelPick.js', '../../res/plugins/yifeng/providerSelects.js','../../js/order/pickPrint.js']);
    })();
</script>

</html>
